import axios from 'axios';
import { useEffect, useState } from 'react';

function useGetPost () {
  const [post, setPost] = useState({});
  useEffect(() => {
    axios.get('http://jsonplaceholder.typicode.com/posts/1')
      .then(response => setPost(response.data));
  }, []);
  return [post, setPost];
}

function CustomizeHookTest() {
  const [post] = useGetPost();
  return (
    <div>
      <div>{post.title}</div>
      <div>{post.body}</div>
    </div>
  );
}

export default CustomizeHookTest;